package com.ssy.lingxi.settle.accounts.model.vo.request;

import com.ssy.lingxi.settle.accounts.model.constant.ApplyAmountTypeEnum;
import com.ssy.lingxi.settle.accounts.model.constant.CommonBooleanEnum;
import com.ssy.lingxi.settle.accounts.model.constant.SettleAccountsServiceContants;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 新增对账单行明细核销记录VO
 * @author 彭冬冬
 * @date 2021/12/28
 * @version 2.0.0
 */
public class ApplyAmountRowWriteOffRecordSaveVO implements Serializable {
    private static final long serialVersionUID = -5619950929259056902L;

    public ApplyAmountRowWriteOffRecordSaveVO() {
    }

    public ApplyAmountRowWriteOffRecordSaveVO(Long id,
                                              String applyNo,
                                              Integer applyType,
                                              String applyAbstract,
                                              Long applyRowId,
                                              Long applyRowBillId,
                                              String applyRowBillNo,
                                              String applyRowBillAbstract,
                                              LocalDateTime applyBillDate,
                                              String applyRowBillStatus,
                                              BigDecimal taxRate,
                                              BigDecimal applyRowPayment,
                                              BigDecimal totalWriteAmount) {
        this.id = id;
        this.applyNo = applyNo;
        this.applyType = applyType;
        this.applyTypeName = ApplyAmountTypeEnum.getNameByCode(applyType);
        this.applyAbstract = applyAbstract;
        this.applyRowId = applyRowId;
        this.applyRowBillId = applyRowBillId;
        this.applyRowBillNo = applyRowBillNo;
        this.applyRowBillAbstract = applyRowBillAbstract;
        this.applyBillDate = applyBillDate.format(SettleAccountsServiceContants.DEFAULT_DATE_FORMATTER);
        this.applyRowBillStatus = applyRowBillStatus;
        this.applyRowBillHasTax = taxRate.compareTo(BigDecimal.ZERO) > 0? CommonBooleanEnum.YES.getCode() :CommonBooleanEnum.NO.getCode();
        this.applyRowBillTaxRate = taxRate;
        this.applyStatusName = applyRowBillStatus;
        this.applyRowPayment = applyRowPayment;
        this.canWriteAmount = applyRowPayment.subtract(totalWriteAmount);
        this.writeOffAmount = totalWriteAmount;
    }

    /**
     * 核销请款单id
     */
    @NotNull(message = "核销请款单id必须存在")
    @Positive(message = "供应商会员Id要大于0")
    private Long id;

    /**
     * 核销请款单编号
     */
    private String applyNo;

    /**
     * 核销请款单类型
     */
    private Integer applyType;

    /**
     * 核销请款单类型名称
     */
    private String applyTypeName;

    /**
     * 核销请款单摘要
     */
    private String applyAbstract;

    /**
     * 核销请款单行id
     */
    @NotNull(message = "核销请款单行id必须存在")
    @Positive(message = "核销请款单行id要大于0")
    private Long applyRowId;

    /**
     * 请款单据id
     */
    private Long applyRowBillId;
    /**
     * 单据编号
     */
    private String applyRowBillNo;

    /**
     * 单据摘要
     */
    private String applyRowBillAbstract;

    /**
     * 请款单据日期
     */
    private String applyBillDate;

    /**
     * 请款单据状态
     */
    private String applyRowBillStatus;
    /**
     * 请款单据状态名称
     */
    private String applyStatusName;

    /**
     * 是否含税
     */
    private Integer applyRowBillHasTax;

    /**
     * 税额
     */
    private BigDecimal applyRowBillTaxRate;

    /**
     * 请款金额
     */
    private BigDecimal applyRowPayment;

    /**
     * 可以核销金额
     */
    private BigDecimal canWriteAmount;

    /**
     * 核销金额 核销金额必须存在
     */
    @NotNull(message = "核销金额必须存在")
    @Positive(message = "核销金额要大于0")
    private BigDecimal writeOffAmount;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getApplyNo() {
        return applyNo;
    }

    public void setApplyNo(String applyNo) {
        this.applyNo = applyNo;
    }

    public String getApplyTypeName() {
        return applyTypeName;
    }

    public void setApplyTypeName(String applyTypeName) {
        this.applyTypeName = applyTypeName;
    }

    public String getApplyAbstract() {
        return applyAbstract;
    }

    public void setApplyAbstract(String applyAbstract) {
        this.applyAbstract = applyAbstract;
    }

    public Long getApplyRowId() {
        return applyRowId;
    }

    public void setApplyRowId(Long applyRowId) {
        this.applyRowId = applyRowId;
    }

    public Long getApplyRowBillId() {
        return applyRowBillId;
    }

    public void setApplyRowBillId(Long applyRowBillId) {
        this.applyRowBillId = applyRowBillId;
    }

    public String getApplyRowBillNo() {
        return applyRowBillNo;
    }

    public void setApplyRowBillNo(String applyRowBillNo) {
        this.applyRowBillNo = applyRowBillNo;
    }

    public String getApplyBillDate() {
        return applyBillDate;
    }

    public void setApplyBillDate(String applyBillDate) {
        this.applyBillDate = applyBillDate;
    }

    public String getApplyStatusName() {
        return applyStatusName;
    }

    public void setApplyStatusName(String applyStatusName) {
        this.applyStatusName = applyStatusName;
    }

    public BigDecimal getApplyRowPayment() {
        return applyRowPayment;
    }

    public void setApplyRowPayment(BigDecimal applyRowPayment) {
        this.applyRowPayment = applyRowPayment;
    }

    public BigDecimal getCanWriteAmount() {
        return canWriteAmount;
    }

    public void setCanWriteAmount(BigDecimal canWriteAmount) {
        this.canWriteAmount = canWriteAmount;
    }

    public BigDecimal getWriteOffAmount() {
        return writeOffAmount;
    }

    public void setWriteOffAmount(BigDecimal writeOffAmount) {
        this.writeOffAmount = writeOffAmount;
    }

    public void setApplyType(Integer applyType) {
        this.applyType = applyType;
    }

    public String getApplyRowBillStatus() {
        return applyRowBillStatus;
    }

    public void setApplyRowBillStatus(String applyRowBillStatus) {
        this.applyRowBillStatus = applyRowBillStatus;
    }

    public Integer getApplyType() {
        return applyType;
    }

    public Integer getApplyRowBillHasTax() {
        return applyRowBillHasTax;
    }

    public void setApplyRowBillHasTax(Integer applyRowBillHasTax) {
        this.applyRowBillHasTax = applyRowBillHasTax;
    }

    public BigDecimal getApplyRowBillTaxRate() {
        return applyRowBillTaxRate;
    }

    public void setApplyRowBillTaxRate(BigDecimal applyRowBillTaxRate) {
        this.applyRowBillTaxRate = applyRowBillTaxRate;
    }

    public String getApplyRowBillAbstract() {
        return applyRowBillAbstract;
    }

    public void setApplyRowBillAbstract(String applyRowBillAbstract) {
        this.applyRowBillAbstract = applyRowBillAbstract;
    }
}
